//setup
//# cnpm i gulp gulp-concat gulp-minify-css gulp-rev gulp-rev-collector gulp-base64 gulp-uglify --save-dev
//run the gulp
//# gulp all
//gulp portalcss
//gulp admincss
//gulp designercss
//gulp logincss
//gulp taskcss
//gulp portaljs
//gulp adminjs
//gulp designerjs
//gulp portalloginjs
//gulp adminloginjs
//gulp taskjs

var gulp = require('gulp');
var concat = require('gulp-concat');                            //- 多个文件合并为一个；
var minifyCss = require('gulp-minify-css');                     //- 压缩CSS为一行；
var rev = require('gulp-rev');                                  //- 对文件名加MD5后缀
var revCollector = require('gulp-rev-collector');               //- 路径替换
var base64 = require('gulp-base64');
var uglify = require('gulp-uglify');


//============================= Style sheet ===========
//====================================================

gulp.task('portalcss', function() {
    gulp.src([
        "./static/skins/lightblue/assets/dhtmlx4/dhtmlx_dhx_web.css",
        "./static/skins/lightblue/assets/bootstrap/global/plugins/font-awesome/css/font-awesome.min.css",
        "./static/skins/lightblue/assets/bootstrap/global/plugins/simple-line-icons/css/simple-line-icons.min.css",
        "./static/skins/lightblue/assets/bootstrap/global/plugins/bootstrap/css/bootstrap.min.css",
        "./static/skins/lightblue/assets/bootstrap/global/plugins/uniform/css/uniform.default.css",
        "./static/skins/lightblue/assets/bootstrap/global/plugins/bootstrap-switch/css/bootstrap-switch.min.css",
        "./static/skins/lightblue/assets/bootstrap/global/plugins/bootstrap-datepicker/css/bootstrap-datepicker3.min.css",
        "./static/skins/lightblue/assets/bootstrap/global/plugins/bootstrap-select/bootstrap-select.min.css",
        "./static/skins/lightblue/assets/bootstrap/global/plugins/select2/select2.css",
        "./static/skins/lightblue/assets/bootstrap/global/plugins/bootstrap-table/bootstrap-table.min.css",
        "./static/skins/lightblue/assets/bootstrap/global/plugins/bootstrap-sweetalert/sweetalert.css",
        "./static/skins/lightblue/assets/bootstrap/global/plugins/bootstrap-toastr/toastr.min.css",
        "./static/skins/lightblue/assets/bootstrap/global/plugins/bootstrap-pagination/bootstrap-pagination.css",
        "./static/skins/lightblue/assets/bootstrap/global/plugins/jquery-jcrop/jquery.Jcrop.css",
        "./static/skins/lightblue/assets/bootstrap/global/css/components-md.css",
        "./static/skins/lightblue/assets/bootstrap/global/css/plugins-md.css",
        "./static/skins/lightblue/assets/bootstrap/admin/layout2/css/layout.css",
        "./static/skins/lightblue/assets/bootstrap/admin/layout2/css/themes/grey.css",
        "./static/skins/lightblue/assets/bootstrap/admin/layout2/css/custom.css",
        "./static/skins/lightblue/assets/bootstrap/admin/pages/css/todo.css",
        "./static/skins/lightblue/assets/bootstrap/global/plugins/jstree/themes/default/style.min.css",
        "./static/skins/lightblue/assets/jquery-ui/jquery-ui.css"
        ])    //- 需要处理的css文件，放到一个字符串数组里
        .pipe(base64({
            extensions: ['png','jpg','jpeg','gif','svg','woff','woff2','ttf','eot', /\.jpg#datauri$/i],
            maxImageSize: 64*1024, // bytes
            debug: true
        }))                                            //-
        .pipe(concat('portal.all.css'))                            //- 合并后的文件名
        .pipe(minifyCss())                                      //- 压缩处理成一行
        .pipe(gulp.dest('./static/skins/lightblue/assetsmin/platform/portal/'));                               //- 输出文件本地
});

gulp.task('admincss', function() {
    gulp.src([
        "./static/skins/lightblue/assets/dhtmlx4/dhxtree.min.css",
        "./static/skins/lightblue/assets/dhtmlx4/dhtmlx_dhx_web.css",
        "./static/skins/lightblue/assets/bootstrap/global/plugins/font-awesome/css/font-awesome.min.css",
        "./static/skins/lightblue/assets/bootstrap/global/plugins/simple-line-icons/css/simple-line-icons.min.css",
        "./static/skins/lightblue/assets/bootstrap/global/plugins/bootstrap/css/bootstrap.min.css",
        "./static/skins/lightblue/assets/bootstrap/global/plugins/uniform/css/uniform.default.css",
        "./static/skins/lightblue/assets/bootstrap/global/plugins/bootstrap-switch/css/bootstrap-switch.min.css",
        "./static/skins/lightblue/assets/bootstrap/global/plugins/bootstrap-datepicker/css/bootstrap-datepicker3.min.css",
        "./static/skins/lightblue/assets/bootstrap/global/plugins/bootstrap-table/bootstrap-table.min.css",
        "./static/skins/lightblue/assets/bootstrap/global/plugins/bootstrap-editable/bootstrap-editable.css",
        "./static/skins/lightblue/assets/bootstrap/global/plugins/bootstrap-select/bootstrap-select.min.css",
        "./static/skins/lightblue/assets/bootstrap/global/plugins/select2/select2.css",
        "./static/skins/lightblue/assets/bootstrap/global/css/components.css",
        "./static/skins/lightblue/assets/bootstrap/global/css/plugins.css",
        "./static/skins/lightblue/assets/bootstrap/admin/layout2/css/layout.css",
        "./static/skins/lightblue/assets/bootstrap/admin/layout2/css/themes/light.css",
        "./static/skins/lightblue/assets/bootstrap/admin/layout2/css/custom.css",
        "./static/skins/lightblue/assets/bootstrap/global/plugins/bootstrap-sweetalert/sweetalert.css",
        "./static/skins/lightblue/assets/bootstrap/global/plugins/bootstrap-toastr/toastr.min.css",
        "./static/skins/lightblue/assets/bootstrap/global/plugins/jstree/themes/default/style.min.css",
        "./static/skins/lightblue/assets/bootstrap/global/css/plugins.css",
    ])    //- 需要处理的css文件，放到一个字符串数组里
        .pipe(base64({
            extensions: ['png','jpg','jpeg','gif','svg','woff','woff2','ttf','eot', /\.jpg#datauri$/i],
            maxImageSize: 64*1024, // bytes
            debug: true
        }))                                            //-
        .pipe(concat('admin.all.css'))                            //- 合并后的文件名
        .pipe(minifyCss())                                      //- 压缩处理成一行
        .pipe(gulp.dest('./static/skins/lightblue/assetsmin/platform/admin/'));                               //- 输出文件本地
});

gulp.task('designercss', function() {
    gulp.src([
        "./static/skins/lightblue/assets/platform/designer/css/designer.css",
        "./static/skins/lightblue/assets/platform/designer/css/diagram-js.css",
        "./static/skins/lightblue/assets/platform/designer/css/bpmn-embedded.css",
        "./static/skins/lightblue/assets/jquery-ui/jquery-ui.css",
        "./static/skins/lightblue/assets/jquery-ui/jquery-ui.theme.css",
        "./static/skins/lightblue/assets/jquery-ui/jquery-ui.structure.css",
        "./static/skins/lightblue/assets/dhtmlx4/skins/dhx_web_lightblue/dhtmlx.css",
        "./static/skins/lightblue/assets/3rdpartyother/tipsy.css",
    ])    //- 需要处理的css文件，放到一个字符串数组里
        .pipe(base64({
            extensions: ['png','jpg','jpeg','gif','svg','woff','woff2','ttf','eot', /\.jpg#datauri$/i],
            //maxImageSize: 64*1024, // bytes
            debug: true
        }))                                            //-
        .pipe(concat('designer.all.css'))                            //- 合并后的文件名
        .pipe(minifyCss())                                      //- 压缩处理成一行
        .pipe(gulp.dest('./static/skins/lightblue/assetsmin/platform/admin/'));                               //- 输出文件本地
});

gulp.task('logincss', function() {
    gulp.src([
        "./static/skins/lightblue/assets/bootstrap/global/plugins/simple-line-icons/css/simple-line-icons.min.css",
        "./static/skins/lightblue/assets/bootstrap/global/plugins/bootstrap/css/bootstrap.min.css",
        "./static/skins/lightblue/assets/bootstrap/admin/pages/css/login-soft.css",
        "./static/skins/lightblue/assets/bootstrap/global/css/components-rounded.css",
    ])    //- 需要处理的css文件，放到一个字符串数组里
        .pipe(base64({
            extensions: ['png','jpg','jpeg','gif','svg','woff','woff2','ttf','eot', /\.jpg#datauri$/i],
            maxImageSize: 64*1024, // bytes
            debug: true
        }))                                            //-
        .pipe(concat('login.all.css'))                            //- 合并后的文件名
        //.pipe(minifyCss())                                      //- 压缩处理成一行
        .pipe(gulp.dest('./static/skins/lightblue/assetsmin/platform/portal/'));                               //- 输出文件本地
});

gulp.task('taskcss', function() {
    gulp.src([
        "./static/skins/lightblue/assets/dhtmlx4/skins/dhx_skyblue_clouds/dhtmlx.css",
        "./static/skins/lightblue/assets/bootstrap/global/plugins/font-awesome/css/font-awesome.min.css",
        "./static/skins/lightblue/assets/bootstrap/global/plugins/bootstrap/css/bootstrap.min.css",
        "./static/skins/lightblue/assets/bootstrap/global/css/components-md.css",
        "./static/skins/lightblue/assets/bootstrap/global/css/plugins-md.css",
        "./static/skins/lightblue/assets/bootstrap/global/plugins/bootstrap-sweetalert/sweetalert.css",
        "./static/skins/lightblue/assets/bootstrap/global/plugins/bootstrap-toastr/toastr.min.css",
        "./static/jsplatform/portal/layout/task/v0/custom.css",
        "./static/jsplatform/portal/layout/task/v0/wrapper.css",
        "./static/skins/lightblue/assets/platform/designer/css/diagram-js.css",
        "./static/skins/lightblue/assets/jquery-ui/jquery-ui.css",
        "./static/skins/lightblue/assets/bootstrap/global/plugins/jstree/themes/default/style.min.css",
        "./static/skins/lightblue/assets/bootstrap/global/plugins/datetimepicker4form/timepicker-m.css",
        "./static/skins/lightblue/assets/bootstrap/global/plugins/datetimepicker4form/bootstrap-datetimepicker-m.css",
        "./static/skins/lightblue/assets/bootstrap/global/plugins/bootstrap-table/bootstrap-table.min.css",
    ])    //- 需要处理的css文件，放到一个字符串数组里
        .pipe(base64({
            extensions: ['png','jpg','jpeg','gif','svg','woff','woff2','ttf','eot', /\.jpg#datauri$/i],
            //maxImageSize: 8*1024, // bytes
            debug: true
        }))                                            //-
        .pipe(concat('task.all.css'))                            //- 合并后的文件名
        .pipe(minifyCss())                                      //- 压缩处理成一行
        .pipe(gulp.dest('./static/skins/lightblue/assetsmin/platform/task/'));                               //- 输出文件本地
});


//============================= Javascript ===========
//====================================================

gulp.task('portaljs', function() {
    gulp.src([
        "./static/jslib/bootstrap/global/plugins/respond.min.js",
        "./static/jslib/bootstrap/global/plugins/excanvas.min.js",
        "./static/jslib/3rdpartyother/json2.js",
        "./static/jslib/3rdpartyother/lodash.core.min.js",
        "./static/jslib/3rdpartyother/base64.js",
        "./static/jslib/3rdpartyother/stomp/stomp.js",
        "./static/jslib/3rdpartyother/stomp/sockjs.js",
        "./static/jslib/bootstrap/global/plugins/jquery.js",
        "./static/jslib/bootstrap/global/plugins/jquery-migrate.min.js",
        "./static/jslib/jquery/jquery.form.min.js",
        "./static/jslib/bootstrap/global/plugins/jquery-ui/jquery-ui.min.js",
        "./static/jslib/bootstrap/global/plugins/bootstrap/js/bootstrap.min.js",
        "./static/jslib/bootstrap/global/plugins/jquery-validation/js/jquery.validate.min.js",
        "./static/jslib/bootstrap/global/plugins/bootstrap-hover-dropdown/bootstrap-hover-dropdown.min.js",
        "./static/jslib/bootstrap/global/plugins/jquery-slimscroll/jquery.slimscroll.min.js",
        "./static/jslib/bootstrap/global/plugins/jquery.blockui.min.js",
        "./static/jslib/bootstrap/global/plugins/jquery.cokie.min.js",
        "./static/jslib/bootstrap/global/plugins/uniform/jquery.uniform.min.js",
        "./static/jslib/bootstrap/global/plugins/bootstrap-switch/js/bootstrap-switch.min.js",
        "./static/jslib/bootstrap/global/plugins/bootstrap-datepicker/js/bootstrap-datepicker.min.js",
        "./static/jslib/bootstrap/global/plugins/bootstrap-select/bootstrap-select.min.js",
        "./static/jslib/bootstrap/global/plugins/select2/select2.min.js",
        "./static/jslib/bootstrap/global/plugins/bootstrap-contextmenu/bootstrap-contextmenu.js",
        "./static/jslib/bootstrap/global/plugins/jstree/jstree.min.js",
        "./static/jslib/bootstrap/global/plugins/bootstrap-sweetalert/sweetalert.min.js",
        "./static/jslib/bootstrap/global/plugins/bootstrap-toastr/toastr.min.js",
        "./static/jslib/bootstrap/global/plugins/bootstrap-table/bootstrap-table.min.js",
        "./static/jslib/bootstrap/global/plugins/bootstrap-pagination/bootstrap-pagination.js",
        "./static/jslib/bootstrap/global/plugins/bootbox/bootbox.min.js",
        "./static/jslib/dhtmlx4/alone/dhxgrid.js",
        "./static/jslib/dhtmlx4/alone/dhxtoolbar.js",
        "./static/jslib/dhtmlx4/alone/dhxcontainer.js",
        "./static/jslib/dhtmlx4/alone/dhxlayout.js",
        "./static/jslib/dhtmlx4/ext/dhxgrid.js",
        "./static/jslib/dhtmlx4/ext/validator.js",
        "./static/jslib/dhtmlx4/ext/excell_types.js",
        "./static/jslib/bootstrap/global/scripts/metronic.js",
        "./static/jslib/bootstrap/admin/layout2/scripts/layout.js",
        "./static/jslib/bootstrap/admin/layout2/scripts/themetool.js",
        "./static/jslib/util/common_bootstrap.js",
        "./static/jsplatform/portal/index/index.js",
        "./static/jsplatform/portal/layout/taskcenter/list_todo.js",
    ])
        .pipe(concat('portal.all.js'))
        .pipe(uglify())
        .pipe(gulp.dest('./static/jsmin/platform/portal/'));

    gulp.src([
        "./static/jslib/bootstrap/global/plugins/jquery-validation/js/localization/messages_zh.min.js",
        "./static/jslib/bootstrap/global/plugins/bootstrap-datepicker/locales/bootstrap-datepicker.zh.min.js",
        "./static/jslib/bootstrap/global/plugins/bootstrap-table/locale/bootstrap-table-zh.min.js",
        "./static/jslib/bootstrap/global/plugins/select2/select2_locale_zh.js",
        "./static/jslib/dhtmlx4/ext/dhx_i18n_zh.js",
        "./static/jsplatform/portal/index/index_i18n_zh.js",
        "./static/jsplatform/portal/layout/taskcenter/list_todo_i18n_zh.js",
        "./static/jsplatform/portal/layout/taskcenter/start_i18n_zh.js",
        "./static/jsplatform/portal/layout/taskcenter/list_done_i18n_zh.js",
        "./static/jsplatform/portal/layout/taskcenter/list_appl_i18n_zh.js",
        "./static/jsplatform/portal/layout/taskcenter/list_draft_i18n_zh.js",
        "./static/jsplatform/portal/pages/profile/user_i18n_zh.js",
        "./static/jsplatform/admin/layout/config/bdm_i18n_zh.js",
    ])
        .pipe(concat('portal_i18n_zh.all.js'))
        .pipe(uglify())
        .pipe(gulp.dest('./static/jsmin/platform/portal/'));

});

gulp.task('adminjs', function() {
    gulp.src([
        "./static/jslib/bootstrap/global/plugins/respond.min.js",
        "./static/jslib/bootstrap/global/plugins/excanvas.min.js",
        "./static/jslib/3rdpartyother/json2.js",
        "./static/jslib/3rdpartyother/lodash.core.min.js",
        "./static/jslib/3rdpartyother/base64.js",
        "./static/jslib/bootstrap/global/plugins/jquery.js",
        "./static/jslib/bootstrap/global/plugins/jquery-migrate.min.js",
        "./static/jslib/jquery/jquery.form.min.js",
        "./static/jslib/bootstrap/global/plugins/jquery-ui/jquery-ui.min.js",
        "./static/jslib/bootstrap/global/plugins/bootstrap/js/bootstrap.min.js",
        "./static/jslib/bootstrap/global/plugins/jquery-validation/js/jquery.validate.js",
        "./static/jslib/bootstrap/global/plugins/jquery-validation/js/localization/messages_zh.min.js",
        "./static/jslib/bootstrap/global/plugins/bootstrap-hover-dropdown/bootstrap-hover-dropdown.min.js",
        "./static/jslib/bootstrap/global/plugins/jquery.blockui.min.js",
        "./static/jslib/bootstrap/global/plugins/jquery.cokie.min.js",
        "./static/jslib/bootstrap/global/plugins/uniform/jquery.uniform.min.js",
        "./static/jslib/bootstrap/global/plugins/bootstrap-switch/js/bootstrap-switch.min.js",
        "./static/jslib/bootstrap/global/plugins/bootstrap-datepicker/js/bootstrap-datepicker.min.js",
        "./static/jslib/bootstrap/global/plugins/bootstrap-select/bootstrap-select.min.js",
        "./static/jslib/bootstrap/global/plugins/select2/select2.min.js",
        "./static/jslib/bootstrap/global/plugins/bootstrap-contextmenu/bootstrap-contextmenu.js",
        "./static/jslib/bootstrap/global/plugins/bootstrap-table/bootstrap-table.min.js",
        "./static/jslib/bootstrap/global/plugins/bootstrap-editable/bootstrap-editable.min.js",
        "./static/jslib/bootstrap/global/plugins/bootstrap-sweetalert/sweetalert.min.js",
        "./static/jslib/bootstrap/global/plugins/bootstrap-toastr/toastr.min.js",
        "./static/jslib/bootstrap/global/plugins/bootbox/bootbox.min.js",
        "./static/jslib/bootstrap/global/plugins/jstree/jstree.min.js",
        "./static/jslib/dhtmlx4/alone/dhxtree.min.js",
        "./static/jslib/dhtmlx4/alone/dhxgrid.js",
        "./static/jslib/dhtmlx4/alone/dhxtoolbar.js",
        "./static/jslib/dhtmlx4/alone/dhxcontainer.js",
        "./static/jslib/dhtmlx4/alone/dhxlayout.js",
        "./static/jslib/dhtmlx4/alone/dhxwindows.js",
        "./static/jslib/dhtmlx4/alone/dhxtabbar.js",
        "./static/jslib/dhtmlx4/ext/dhxgrid.js",
        "./static/jslib/dhtmlx4/ext/validator.js",
        "./static/jslib/dhtmlx4/ext/excell_types.js",
        "./static/jslib/dhtmlx4/ext/dhxwindow.js",
        "./static/jslib/bootstrap/global/scripts/metronic.js",
        "./static/jslib/bootstrap/admin/layout2/scripts/themetool.js",
        "./static/jslib/util/common_bootstrap.js",
        "./static/jsplatform/admin/index/layout.js",
        "./static/jsplatform/admin/index/index.js",
    ])
        .pipe(concat('admin.all.js'))
        .pipe(uglify({mangle:true}))
        .pipe(gulp.dest('./static/jsmin/platform/admin/'));

    gulp.src([
        "./static/jslib/bootstrap/global/plugins/jquery-validation/js/localization/messages_zh.min.js",
        "./static/jslib/bootstrap/global/plugins/bootstrap-datepicker/locales/bootstrap-datepicker.zh.min.js",
        "./static/jslib/bootstrap/global/plugins/bootstrap-table/locale/bootstrap-table-zh.min.js",
        "./static/jslib/bootstrap/global/plugins/select2/select2_locale_zh.js",
        "./static/jslib/dhtmlx4/ext/dhx_i18n_zh.js",
        "./static/jsplatform/admin/index/index_i18n_zh.js",
        "./static/jsplatform/admin/layout/auth/manageRes_i18n_zh.js",
        "./static/jsplatform/admin/layout/fa/manageOrg_i18n_zh.js",
        "./static/jsplatform/admin/layout/fa/manageOrgPosUser_i18n_zh.js",
        "./static/jsplatform/admin/layout/fa/managePos_i18n_zh.js",
        "./static/jsplatform/admin/layout/fa/manageRole_i18n_zh.js",
        "./static/jsplatform/admin/layout/fa/manageUser_i18n_zh.js",
        "./static/jsplatform/admin/layout/fa/managePg_i18n_zh.js",
        "./static/jsplatform/admin/layout/log/oplog_i18n_zh.js",
        "./static/jsplatform/admin/layout/log/syslog_i18n_zh.js",
        "./static/jsplatform/admin/layout/process/managePd_i18n_zh.js",
        "./static/jsplatform/admin/layout/process/managePi_i18n_zh.js",
        "./static/jsplatform/admin/layout/process/statisticsPi_i18n_zh.js",
        "./static/jsplatform/admin/layout/config/manageBo1_i18n_zh.js",
        "./static/jsplatform/admin/layout/config/manageDict_i18n_zh.js",
        "./static/jsplatform/admin/layout/config/manageSvc_i18n_zh.js",
        "./static/jsplatform/admin/layout/config/manageForm_i18n_zh.js",
        "./static/jsplatform/admin/layout/config/manageBdm_i18n_zh.js",
        "./static/jsplatform/admin/layout/config/bdm_i18n_zh.js",
    ])
        .pipe(concat('admin_i18n_zh.all.js'))
        .pipe(uglify())
        .pipe(gulp.dest('./static/jsmin/platform/admin/'));

});

gulp.task('designerjs', function() {
    gulp.src([
        "./static/jslib/jquery/jquery1.12.4.js",
        "./static/jslib/jquery/jquery.tipsy.js",
        "./static/jslib/3rdpartyother/json2.js",
        "./static/jslib/3rdpartyother/jsonselect.min.js",
        "./static/jslib/3rdpartyother/xml2json.js",
        "./static/jslib/util/common.js",
        "./static/jslib/jquery-ui/jquery-ui.js",
        "./static/jslib/dhtmlx4/dhtmlx.js",
        "./static/jslib/dhtmlx4/ext/dhxgrid.js",
        "./static/jslib/dhtmlx4/ext/dhxwindow.js",
        "./static/jslib/dhtmlx4/ext/excell_types.js",
        "./static/jslib/dhtmlx4/ext/validator.js",
    ])
        .pipe(concat('designer_import.all.js'))
        .pipe(uglify())
        .pipe(gulp.dest('./static/jsmin/platform/admin/designer/'));

    gulp.src([
        "./static/jslib/dhtmlx4/ext/dhx_i18n_zh.js",
        "./static/jsplatform/admin/designer/flowprop_elem_i18n_zh.js",
        "./static/jsplatform/admin/designer/flow_i18n_zh.js",
    ])
        .pipe(concat('designer_i18n_zh.all.js'))
        .pipe(uglify())
        .pipe(gulp.dest('./static/jsmin/platform/admin/designer/'));

    gulp.src([
        "./static/jsplatform/admin/designer/flowprop_elem.js",
        "./static/jsplatform/admin/designer/flowprop_propfunc.js",
        "./static/jsplatform/admin/designer/flow.js",
    ])
        .pipe(concat('designer_flow.all.js'))
        .pipe(uglify())
        .pipe(gulp.dest('./static/jsmin/platform/admin/designer/'));

    gulp.src([
        "./static/jsplatform/admin/designer/flowprop_elem.js",
        "./static/jsplatform/admin/designer/flowprop_propfunc.js",
        "./static/jsplatform/admin/designer/flow.js",
        "./static/jsplatform/admin/designer/pichange.js",
    ])
        .pipe(concat('designer_flow_pichange.all.js'))
        .pipe(uglify())
        .pipe(gulp.dest('./static/jsmin/platform/admin/designer/'));

    gulp.src([
        "./static/jsplatform/admin/designer/flowmain.js",
    ])
        .pipe(concat('designer_flowmain.all.js'))
        .pipe(uglify())
        .pipe(gulp.dest('./static/jsmin/platform/admin/designer/'));

    gulp.src([
        "./static/jsplatform/admin/designer/modules/**/i18n_zh.js",
    ])
        .pipe(concat('designer_elems_i18n.all.js'))
        .pipe(uglify())
        .pipe(gulp.dest('./static/jsmin/platform/admin/designer/'));

    gulp.src([
        "./static/jsplatform/admin/designer/modules/**/prop.js",
    ])
        .pipe(concat('designer_elems.all.js'))
        .pipe(uglify())
        .pipe(gulp.dest('./static/jsmin/platform/admin/designer/'));
});

gulp.task('designerjsnomin', function() {
    gulp.src([
        "./static/jslib/jquery/jquery1.12.4.js",
        "./static/jslib/jquery/jquery.tipsy.js",
        "./static/jslib/3rdpartyother/json2.js",
        "./static/jslib/3rdpartyother/jsonselect.min.js",
        "./static/jslib/3rdpartyother/xml2json.js",
        "./static/jslib/util/common.js",
        "./static/jslib/jquery-ui/jquery-ui.js",
        "./static/jslib/dhtmlx4/dhtmlx.js",
        "./static/jslib/dhtmlx4/ext/dhxgrid.js",
        "./static/jslib/dhtmlx4/ext/dhxwindow.js",
        "./static/jslib/dhtmlx4/ext/excell_types.js",
        "./static/jslib/dhtmlx4/ext/validator.js",
    ])
        .pipe(concat('designer_import.all.js'))
        //.pipe(uglify())
        .pipe(gulp.dest('./static/jsmin/platform/admin/designer/'));

    gulp.src([
        "./static/jsplatform/admin/designer/flowprop_elem_i18n_zh.js",
        "./static/jsplatform/admin/designer/flow_i18n_zh.js",
    ])
        .pipe(concat('designer_i18n_zh.all.js'))
        //.pipe(uglify())
        .pipe(gulp.dest('./static/jsmin/platform/admin/designer/'));

    gulp.src([
        "./static/jsplatform/admin/designer/flowprop_elem.js",
        "./static/jsplatform/admin/designer/flowprop_propfunc.js",
        "./static/jsplatform/admin/designer/flow.js",
    ])
        .pipe(concat('designer_flow.all.js'))
        //.pipe(uglify())
        .pipe(gulp.dest('./static/jsmin/platform/admin/designer/'));

    gulp.src([
        "./static/jsplatform/admin/designer/flowmain.js",
    ])
        .pipe(concat('designer_flowmain.all.js'))
        //.pipe(uglify())
        .pipe(gulp.dest('./static/jsmin/platform/admin/designer/'));

    gulp.src([
        "./static/jsplatform/admin/designer/modules/**/i18n_zh.js",
    ])
        .pipe(concat('designer_elems_i18n.all.js'))
        //.pipe(uglify())
        .pipe(gulp.dest('./static/jsmin/platform/admin/designer/'));

    gulp.src([
        "./static/jsplatform/admin/designer/modules/**/prop.js",
    ])
        .pipe(concat('designer_elems.all.js'))
        //.pipe(uglify())
        .pipe(gulp.dest('./static/jsmin/platform/admin/designer/'));
});

gulp.task('portalloginjs', function() {
    gulp.src([
        "./static/jslib/bootstrap/global/plugins/respond.min.js",
        "./static/jslib/bootstrap/global/plugins/excanvas.min.js",
        "./static/jslib/jquery/jquery1.11.2.min.js",
        "./static/jslib/jquery/jquery.form.min.js",
        "./static/jslib/bootstrap/global/plugins/bootstrap/js/bootstrap.min.js",
        "./static/jslib/bootstrap/global/plugins/jquery-validation/js/jquery.validate.min.js",
        "./static/jslib/bootstrap/global/plugins/jquery-validation/js/localization/messages_zh.min.js",
        "./static/jslib/bootstrap/global/plugins/backstretch/jquery.backstretch.min.js",
        "./static/jsplatform/portal/login/pagestyle.js",
        "./static/jsplatform/portal/login/login.js",
    ])
        .pipe(concat('login.all.js'))
        //.pipe(uglify())
        .pipe(gulp.dest('./static/jsmin/platform/portal/'));
});

gulp.task('adminloginjs', function() {
    gulp.src([
        "./static/jslib/bootstrap/global/plugins/respond.min.js",
        "./static/jslib/bootstrap/global/plugins/excanvas.min.js",
        "./static/jslib/jquery/jquery1.11.2.min.js",
        "./static/jslib/jquery/jquery.form.min.js",
        "./static/jslib/bootstrap/global/plugins/bootstrap/js/bootstrap.min.js",
        "./static/jslib/bootstrap/global/plugins/jquery-validation/js/jquery.validate.min.js",
        "./static/jslib/bootstrap/global/plugins/jquery-validation/js/localization/messages_zh.min.js",
        "./static/jslib/bootstrap/global/plugins/backstretch/jquery.backstretch.min.js",
        "./static/jsplatform/portal/login/pagestyle.js",
        "./static/jsplatform/portal/login/login.js",
    ])
        .pipe(concat('login.all.js'))
        //.pipe(uglify())
        .pipe(gulp.dest('./static/jsmin/platform/admin/'));
});

gulp.task('taskjs', function() {
    gulp.src([
        "./static/jslib/3rdpartyother/json2.js",
        "./static/jslib/3rdpartyother/lodash.core.js",
        "./static/jslib/bootstrap/global/plugins/jquery.js",
        "./static/jslib/jquery/jquery.form.min.js",
        "./static/jslib/3rdpartyother/angular-all.min.js",
        "./static/jslib/jquery/jquery.tipsy.js",
        "./static/jslib/bootstrap/global/plugins/jquery-ui/jquery-ui.min.js",
        "./static/jslib/dhtmlx4/alone/dhxgrid.js",
        "./static/jslib/dhtmlx4/ext/dhxgrid.js",
        "./static/jslib/dhtmlx4/ext/excell_types.js",
        "./static/jslib/dhtmlx4/alone/dhxtoolbar.js",
        "./static/jslib/bootstrap/global/plugins/bootstrap/js/bootstrap.min.js",
        "./static/jslib/bootstrap/global/plugins/datetimepicker4form/bootstrap-timepicker-m.js",
        "./static/jslib/bootstrap/global/plugins/datetimepicker4form/bootstrap-datetimepicker-m.js",
        "./static/jslib/bootstrap/global/plugins/bootstrap-table/bootstrap-table.js",
        "./static/jslib/bootstrap/global/plugins/bootstrap-sweetalert/sweetalert.js",
        "./static/jslib/bootstrap/global/plugins/bootstrap-toastr/toastr.js",
        "./static/jslib/bootstrap/global/plugins/bootbox/bootbox.min.js",
        "./static/jslib/bootstrap/global/plugins/jstree/jstree.min.js",
        "./static/jsplatform/portal/layout/task/v0/bootstrap-modal-ext.js",
        "./static/jsplatform/portal/layout/task/v0/common.js",
        "./static/jslib/bootstrap/global/plugins/bootstrap-datetimepicker/locales/bootstrap-datetimepicker.<%=lang%>.js",
        "./static/jslib/bootstrap/global/plugins/bootstrap-table/locale/bootstrap-table-<%=lang%>.js",
        "./static/jslib/3rdpartyother/svg/snap.svg-min.js",
        "./static/jslib/3rdpartyother/svg/vivus.js",
        "./static/jslib/3rdpartyother/plupload-2.3.6/plupload.full.min.changed.js",
        "./static/jsplatform/admin/designer/flow_style.js",
        "./static/jsplatform/portal/layout/task/v0/attachment.js",
    ])
        .pipe(concat('task.all.js'))
        .pipe(uglify())
        .pipe(gulp.dest('./static/jsmin/platform/task/'));
});

gulp.task('allcss', ['admincss', 'portalcss', 'designercss', 'logincss', 'taskcss']);

gulp.task('alljs', ['adminjs', 'portaljs', 'designerjs', 'portalloginjs', 'adminloginjs', 'taskjs']);

gulp.task('all', ['allcss', 'alljs']);



